/* -----------------
* brief
* 1. this is code gen by tools
* 2. array like [a,b,c] after each field, define the ui html tag in view,
		a for title,
		b for show or not ,
		c for element html tag , currently suppor : check、radio、select、input、textarea、upload tag
* 3. XXX
*/

package adminSaas

import "github.com/mjiulee/lego"

func init() {
	//lego.AddBeanToSynList(new(AdminSaasRoleRight))
}

/* table: "tb_sys_role_right"
 * -----------------
 */
type AdminSaasRoleRight struct {
	Id    int64  `xorm:"pk" json:",string"`               // ["id","hide","hidden"]
	Cdate string `xorm:"DateTime created"` // ["create","show","datetime"]
	Udate string `xorm:"DateTime updated"` // ["update","show","datetime"]
	// add your custom field here
	RoleId int64 `xorm:"default 0 " json:",string"` // ["角色","hide","hidden"]
	SType  int   `xorm:"default 1"`  // ["资源类型","show","radio"]
	SId    int64 `xorm:"default 0 " json:",string"` // ["资源ID","show","input"]
}


func (t* AdminSaasRoleRight)ListByRoleId(id int64) []AdminSaasRoleRight {
	list := make([]AdminSaasRoleRight,0)
	err := lego.GetDBEngine().Table(t).Where("role_id=?",id).Find(&list)
	if nil != err {
		lego.LogError(err)
	}
	return list
}